package zdream.pmfield.stage.buff.seat;

import zdream.pmfield.stage.buff.StageBuff;
import zdream.pmfield.stage.buff.foe.FoeStageBuff;
import zdream.pmfield.stage.director.HookStore;
import zdream.pmfield.stage.director.HookType;
import zdream.pmfield.stage.object.Seat;

/**
 * @author Zdream
 * @date 2023-11-25
 * @since 0.0.1
 */
public abstract class SeatStageBuff extends StageBuff<Seat> {
	/**
	 * 默认 SeatStageBuff 的触发都比 {@link FoeStageBuff} 要晚
	 */
	public static final int DEFAULT_HOOK_PRIORITY = 100;

	protected SeatStageBuff(Seat seat) {
		super(seat);
	}

	/**
	 * 在某个 hook 触发的时候调用什么代码.
	 * @return 手动清理掉这个 hook 的方法.
	 *   当然, 这个 hook 也会在 buff 删除之后自动清理掉
	 */
	protected HookStore.HookHandlerBuilder onHook(HookType type) {
		return target.registerHook()
				.withType(type)
				.withOwner(this)
				.withPriority(DEFAULT_HOOK_PRIORITY)
				.withCleaner(cleaner -> onClean(any -> cleaner.get()));
	}
}
